package com.z996.activity7x.ProcessEngineConfiguration;

import org.activiti.engine.ProcessEngine;
import org.activiti.engine.ProcessEngineConfiguration;
import org.activiti.engine.ProcessEngines;
import org.junit.Test;

/**
 * StandaloneProcessEngineConfiguration
 */
public class TestDemo {
    /**
     * 默认创建方式
     */
    @Test
    public void testCreateDbTable() {

        //直接使用工具类 ProcessEngines，使用classpath下的activiti.cfg.xml中的配置创建processEngine
        ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
        System.out.println(processEngine);

    }

    /**
     * 一般创建方式
     */
    @Test
    public void testCreateDbTable1() {

        //先构建ProcessEngineConfiguration
        ProcessEngineConfiguration configuration = ProcessEngineConfiguration.createProcessEngineConfigurationFromResource("activiti.cfg.xml");
        //通过ProcessEngineConfiguration创建ProcessEngine，此时会创建数据库
        ProcessEngine processEngine = configuration.buildProcessEngine();

    }
}